package com.mypage.adapter;

import java.util.List;

import com.cloudcc.mobile.R;
import com.mypage.bean.NewTaskBean;
import com.mypage.bean.NewTaskBean.mDlist;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class NewListAdapter extends BaseAdapter {
	public Context context;
	public NewTaskBean mDatabean;
	public List<mDlist> data;
    public NewListAdapter(Context ctx, List<mDlist> datas){
    	this.context=ctx;
    	this.data=datas;
    }
    public void setmData( List<mDlist> datas){
    	this.data=datas;
    }
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		if(data==null)
		{
			return 0;
		}
		return data.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ViewHolder mViewHolder = null;
		if (convertView==null) {
			mViewHolder = new ViewHolder();
			convertView = View.inflate(context, R.layout.new_relate_list_item, null);
			mViewHolder.textState = (TextView) convertView.findViewById(R.id.textRelated);
			convertView.setTag(mViewHolder);
		}else{
			mViewHolder = (ViewHolder) convertView.getTag();
		}
		
		
		String s = data.get(position).name;
		mViewHolder.textState.setText(s);
		return convertView;
	}
	public class ViewHolder{
		
	TextView textState;
	
	}
}
